﻿using System;
using System.IO;

namespace ConsoleTextWriter
{
    public class Program
    {
        private const string _path = "frases.txt";

        private static void Main(string[] args)
        {
            if (File.Exists(_path))
                Console.Write(File.ReadAllText(_path));

            ReadAndSaveConsoleLine();
        }

        private static void ReadAndSaveConsoleLine()
        {
            var line = Console.ReadLine();
            if (!string.IsNullOrWhiteSpace(line))
            {
                using (var streamWriter = new StreamWriter(_path, true))
                    streamWriter.WriteLine(line);
                ReadAndSaveConsoleLine();
            }
        }
    }
}